#include<iostream>
#include<sys/eventfd.h>
#include<unistd.h>

using namespace std;

int main()
{
      uint64_t val=1;
      int newfd=eventfd(val,EFD_CLOEXEC|EFD_NONBLOCK);
      write(newfd,&val,sizeof(val));
      write(newfd,&val,sizeof(val));
      write(newfd,&val,sizeof(val));
      uint64_t res;
      read(newfd,&res,sizeof(res));
      cout<<res<<endl;
      return 0;
}